import { UserConfig } from 'vitepress';
import renderPermaLink from './render-perma-link';
import MarkDownItCustomAnchor from './markdown-it-custom-anchor';
import { functionMenuList } from '../function-list/publish/index-view-app/index-view';

const config: UserConfig = {
  title: '前端文档',
  description: '前端模板、发布器等相关文档',
  themeConfig: {
    nav: [
      { text: '模板', link: '/template/index' },
      { text: '样式/布局', link: '/style-layout/style' },
      // { text: '功能清单', link: '/function-list/index' },
      {
        text: '发布器',
        link: '/publish/index',
      },
      {
        text: '其他',
        items: [
          {
            text: '结构设计',
            link: '/structure/route',
          },
          {
            text: '模板插件',
            link: '/plugin/index',
          },
          {
            text: '开发规范',
            link: '/develop/index',
          },
          {
            text: '未整理规范',
            link: '/other/index',
          },
          {
            text: '应用全局模型隐藏配置',
            link: '/other/app-model-global-config',
          },
          {
            text: '视图会话共享变量',
            link: '/other/view-session',
          },
        ],
      },
      { text: '模型配置', target: '_blank', link: 'http://doc.zhr.icu:9000' },
    ],
    sidebar: {
      '/template/': [
        {
          items: [
            { text: '描述', link: '/template/index' },
            { text: '全局配置', link: '/template/global-config' },
            { text: '环境变量', link: '/template/environment' },
            { text: '脚本编写', link: '/template/script' },
          ],
        },
        {
          text: '特殊配置',
          collapsible: true,
          items: [
            { text: '导航缓存', link: '/template/cache' },
            { text: '导航模式', link: '/template/nav-pos' },
            { text: '视图参数转换', link: '/template/nav-params' },
            { text: 'N对N批量新建', link: '/template/batch-add' },
            { text: '其他特殊配置', link: '/template/other-special-config' },
          ]
        },
        {
          text: '部件',
          collapsible: true,
          items: [
            { text: '菜单', link: '/template/control/menu.md' },
            { text: '标题栏', link: '/template/control/caption-bar.md' },
            { text: '图表', link: '/template/control/chart.md' },
            { text: '地图', link: '/template/control/map.md' },
            { text: '数据看板', link: '/template/control/dashboard.md' },
            { text: '卡片', link: '/template/control/data-view.md' },
            { text: '数据关系栏', link: '/template/control/drbar.md' },
            { text: '数据关系分页', link: '/template/control/drtab.md' },
            { text: '表单', link: '/template/control/form.md' },
            { text: '编辑表单', link: '/template/control/edit-form.md' },
            { text: '导航栏', link: '/template/control/exp-bar.md' },
            { text: '表格', link: '/template/control/grid.md' },
            { text: '列表', link: '/template/control/list.md' },
            { text: '面板', link: '/template/control/panel.md' },
            {
              text: '选择视图面板',
              link: '/template/control/pickup-view-panel.md',
            },
            { text: '搜索栏', link: '/template/control/search-bar.md' },
            { text: '搜索表单', link: '/template/control/search-form.md' },
            {
              text: '分页导航面板',
              link: '/template/control/tab-exp-panel.md',
            },
            { text: '工具栏', link: '/template/control/toolbar.md' },
            { text: '树导航栏', link: '/template/control/tree-exp-bar.md' },
            { text: '树', link: '/template/control/tree.md' },
            {
              text: '视图布局面板',
              link: '/template/control/view-layout-panel.md',
            },
            { text: '向导面板', link: '/template/control/wizard-panel.md' },
          ],
        },
        {
          text: '编辑器',
          collapsible: true,
          items: [
            {
              text: '有自定义参数的',
              items: [
                { text: '数组编辑器', link: '/template/editor/array' },
                { text: '级联选择器', link: '/template/editor/cascader' },
                { text: '直接内容', link: '/template/editor/raw' },
                { text: '步进器', link: '/template/editor/stepper' },
                { text: '评分器', link: '/template/editor/rate' },
                { text: '滑动输入条', link: '/template/editor/slider' },
                { text: '选项框', link: '/template/editor/checkbox' },
                { text: '开关部件', link: '/template/editor/switch' },
                { text: '列表框', link: '/template/editor/listbox' },
                {
                  text: '列表框（选择）',
                  link: '/template/editor/listbox-pickup',
                },
                {
                  text: '数据选择（下拉视图）',
                  link: '/template/editor/picker-dropdownview',
                },
                {
                  text: '数据选择（下拉视图、数据链接）',
                  link: '/template/editor/picker-dropdownview-link',
                },
                { text: '图片控件', link: '/template/editor/picture' },
                {
                  text: '图片控件（单项）',
                  link: '/template/editor/picture-one',
                },
                { text: '文件控件', link: '/template/editor/fileuploader' },
                {
                  text: '文件控件（单项）',
                  link: '/template/editor/fileuploader-one',
                },
                {
                  text: '数值范围编辑框',
                  link: '/template/editor/number-range',
                },
                { text: '时间范围选择器', link: '/template/editor/date-range' },
                {
                  text: '时间范围选择器（YYYY-MM-DD）',
                  link: '/template/editor/date-range-notime',
                },
                { text: 'MARKDOWN编辑器', link: '/template/editor/markdown' },
                { text: '代码编辑框', link: '/template/editor/code' },
                { text: '时间选择器', link: '/template/editor/date-picker' },
                { text: '数值框', link: '/template/editor/number' },
                { text: '数据选择', link: '/template/editor/picker' },
                {
                  text: '数据选择（嵌入选择视图）',
                  link: '/template/editor/pickupview',
                },
                { text: '标签', link: '/template/editor/span' },
                { text: '文本框', link: '/template/editor/text-box' },
                { text: '自动填充', link: '/template/editor/ac' },
              ],
            },
            {
              text: '无自定义参数的',
              items: [
                { text: '密码框', link: '/template/editor/password' },
                { text: '多行输入框', link: '/template/editor/textarea' },
                {
                  text: '多行输入框（10行）',
                  link: '/template/editor/textarea-10',
                },
                { text: 'IP 地址输入框', link: '/template/editor/ip-address' },
                {
                  text: '标签（数据链接）',
                  link: '/template/editor/span-link',
                },
                {
                  text: '下拉列表框（多选）',
                  link: '/template/editor/m-dropdown-list',
                },
                { text: '单选项列表', link: '/template/editor/radio-list' },
                { text: '选项框列表', link: '/template/editor/checkbox-list' },
                {
                  text: '地址框（选择）',
                  link: '/template/editor/address-pickup',
                },
                {
                  text: '地址框（支持选择、AC）',
                  link: '/template/editor/address-pickup-ac',
                },
                {
                  text: '时间选择器（YYYY-MM-DD）',
                  link: '/template/editor/date-picker-notime',
                },
                {
                  text: '时间选择器（HH:mm:ss）',
                  link: '/template/editor/date-picker-noday',
                },
                {
                  text: '时间选择器（YYYY-MM-DD HH）',
                  link: '/template/editor/date-picker-hour',
                },
                {
                  text: '时间选择器（YYYY-MM-DD HH:mm）',
                  link: '/template/editor/date-picker-minute',
                },
                {
                  text: '时间选择器（YYYY-MM-DD HH:mm:ss）',
                  link: '/template/editor/date-picker-second',
                },
                {
                  text: '时间选择器（HH:mm）',
                  link: '/template/editor/date-picker-noday-nosecond',
                },
                {
                  text: '数据选择（数据链接）',
                  link: '/template/editor/picker-link',
                },
                {
                  text: '数据选择（无AC）',
                  link: '/template/editor/picker-noac',
                },
                { text: '数据链接', link: '/template/editor/picker-linkonly' },
                {
                  text: '数据选择（无AC、数据链接）',
                  link: '/template/editor/picker-noac-link',
                },
                {
                  text: '数据选择（下拉）',
                  link: '/template/editor/picker-trigger',
                },
                {
                  text: '数据选择（下拉、数据链接）',
                  link: '/template/editor/picker-trigger-link',
                },
                {
                  text: '数据选择（无按钮）',
                  link: '/template/editor/picker-nobutton',
                },
                { text: '下拉列表框', link: '/template/editor/dropdown-list' },
                {
                  text: '图片控件（单项、直接内容）',
                  link: '/template/editor/picture-one-raw',
                },
              ],
            },
          ],
        },
        {
          text: '移动端编辑器（暂未支持）',
          collapsible: true,
          items: [
            {
              text: '有自定义参数的',
              items: [
                {
                  text: '移动端步进器',
                  link: '/template/mob-editor/mob-stepper',
                },
                {
                  text: '移动端评分器',
                  link: '/template/mob-editor/mob-rating',
                },
                {
                  text: '移动端滑动输入条',
                  link: '/template/mob-editor/mob-slider',
                },
                {
                  text: '移动端开关部件',
                  link: '/template/mob-editor/mob-switch',
                },
                {
                  text: '移动端数据选择（下拉视图）',
                  link: '/template/mob-editor/mob-picker-dropdownview',
                },
                {
                  text: '移动端图片控件（单项）',
                  link: '/template/mob-editor/mob-picture',
                },
                {
                  text: '移动端文件控件（单项）',
                  link: '/template/mob-editor/mob-single-fileuploader',
                },
                {
                  text: '移动端文件控件（多项）',
                  link: '/template/mob-editor/mob-multi-fileuploader',
                },
                {
                  text: '移动端数值范围编辑框',
                  link: '/template/mob-editor/mob-number-range',
                },
                {
                  text: '移动端时间范围选择器',
                  link: '/template/mob-editor/mob-date-range',
                },
                {
                  text: '移动端时间范围选择器（YYYY-MM-DD）',
                  link: '/template/mob-editor/mob-date-range-notime',
                },
                { text: '移动端文本框', link: '/template/mob-editor/mob-text' },
                {
                  text: '移动端数值框',
                  link: '/template/mob-editor/mob-number',
                },
                {
                  text: '移动端标签',
                  link: '/template/mob-editor/mob-span',
                },
                {
                  text: '移动端数据选择',
                  link: '/template/mob-editor/mob-picker',
                },
                {
                  text: '移动端时间选择器',
                  link: '/template/mob-editor/mob-date',
                },
                {
                  text: '移动端代码编辑框',
                  link: '/template/mob-editor/mob-code',
                },
                {
                  text: '移动端Markdown编辑框',
                  link: '/template/mob-editor/mob-markdown',
                },
                {
                  text: '移动端级联选择器',
                  link: '/template/mob-editor/mob-cascader',
                },
                {
                  text: '移动端数组编辑器',
                  link: '/template/mob-editor/mob-array',
                },
              ],
            },
            {
              text: '无自定义参数的',
              items: [
                {
                  text: '移动端多行文本',
                  link: '/template/mob-editor/mob-textarea',
                },
                {
                  text: '移动端单选项列表',
                  link: '/template/mob-editor/mob-radio-list',
                },
                {
                  text: '移动端下拉列表（单选）',
                  link: '/template/mob-editor/mob-dropdown-list',
                },
                {
                  text: '移动端下拉列表（多选）',
                  link: '/template/mob-editor/mob-check-list',
                },
                {
                  text: '移动端多数据选择',
                  link: '/template/mob-editor/mob-mpicker',
                },
                {
                  text: '移动端时间选择器（YYYY-MM-DD HH）',
                  link: '/template/mob-editor/mob-date-hour',
                },
                {
                  text: '移动端时间选择器（YYYY-MM-DD HH:mm）',
                  link: '/template/mob-editor/mob-date-minute',
                },
                {
                  text: '移动端时间选择器（HH:mm:ss）',
                  link: '/template/mob-editor/mob-date-noday',
                },
                {
                  text: '移动端时间选择器（HH:mm）',
                  link: '/template/mob-editor/mob-date-noday-nosecond',
                },
                {
                  text: '移动端时间选择器（YYYY-MM-DD）',
                  link: '/template/mob-editor/mob-date-notime',
                },
                {
                  text: '移动端时间选择器（YYYY-MM-DD HH:mm:ss）',
                  link: '/template/mob-editor/mob-date-second',
                },
                {
                  text: '移动端图片控件（单项、直接内容）',
                  link: '/template/mob-editor/mob-picture-raw',
                },
                {
                  text: '移动端图片控件（多项）',
                  link: '/template/mob-editor/mob-picture-list',
                },
                {
                  text: '移动端密码框',
                  link: '/template/mob-editor/mob-password',
                },
                {
                  text: '移动端HTML编辑框',
                  link: '/template/mob-editor/mob-html-text',
                },
                {
                  text: '移动端地图选择器',
                  link: '/template/mob-editor/mob-map-picker',
                },
                {
                  text: '移动端颜色选择器',
                  link: '/template/mob-editor/mob-color-picker',
                },
              ],
            },
          ],
        },
        {
          text: 'FAQ',
          collapsible: true,
          items: [
            { text: '上下文、视图参数', link: '/template/app-context' },
            { text: '面板成员隐藏保活', link: '/template/panel-item-keepalive' },
          ],
        },
      ],
      '/function-list/': [
        {
          items: [
            { text: '清单', link: '/function-list/index.md' },
            { text: '移动端清单', link: '/mob-function-list/index.md' },
          ],
        },
        ...functionMenuList,
      ],
      '/plugin/': [
        {
          items: [
            { text: '快速开始', link: '/plugin/' },
            { text: '插件多层依赖', link: '/plugin/plugin-multi-layer' },
            { text: '静态资源', link: '/plugin/static-resources' },
            { text: '计数器插件', link: '/plugin/counter/counter' },
            { text: '视图插件', link: '/plugin/view/view' },
            { text: '部件插件', link: '/plugin/control/control' },
            { text: '表单成员插件', link: '/plugin/form-user-control/form-user-control' },
            { text: '编辑器插件', link: '/plugin/editor/editor' },
            { text: '表格列插件', link: '/plugin/grid-column/grid-column' },
            { text: '界面行为插件', link: '/plugin/ui-action/ui-action' },
            { text: '实体行为插件', link: '/plugin/de-action/de-action' },
            { text: '面板成员插件', link: '/plugin/panel-item/panel-item' },
            { text: '门户部件插件', link: '/plugin/portlet/portlet' },
            { text: '界面逻辑节点插件', link: '/plugin/ui-logic-node/ui-logic-node' },
          ],
        },
        {
          text: 'FAQ',
          collapsible: true,
          items: [
            {
              text: '[Vue warn]: xxx is called when there is no active component instance to be associate with. Lifecycle injection APIs can only be used during execution of setup().',
              link: '/plugin/plugin-problem',
            },
          ],
        },
      ],
      '/publish/': [
        {
          items: [
            { text: '快速开始', link: '/publish/' },
            { text: '发布对象', link: '/publish/publish-target' },
          ],
        },
        {
          text: 'HandleBars 助手',
          collapsible: true,
          items: [{ text: '助手列表', link: '/publish/publish-helper.md' }],
        },
        {
          text: '使用说明',
          collapsible: true,
          items: [
            { text: '基本用法', link: '/publish/usage/index.md' },
            { text: '应用模型 (apps)', link: '/publish/usage/app.md' },
            {
              text: '应用代码表 (appCodeLists)',
              link: '/publish/usage/app-code-list.md',
            },
            {
              text: '应用计数器 (appCounters)',
              link: '/publish/usage/app-counter.md',
            },
            {
              text: '应用实体 (appEntities)',
              link: '/publish/usage/app-entity.md',
            },
            { text: '应用视图 (pages)', link: '/publish/usage/page.md' },
            { text: '部件发布对象 (ctrls)', link: '/publish/usage/ctrl.md' },
            { text: '界面逻辑 (uiLogics)', link: '/publish/usage/ui-logic.md' },
            {
              text: '应用插件 (appPlugins)',
              link: '/publish/usage/app-plugin.md',
            },
            {
              text: '应用功能组件 (appUtils)',
              link: '/publish/usage/app-util.md',
            },
            {
              text: '编辑器样式 (editorStyles)',
              link: '/publish/usage/editor-style.md',
            },
            {
              text: '视图样式 (viewStyles)',
              link: '/publish/usage/view-style.md',
            },
          ],
        },
      ],
      '/structure/': [
        {
          items: [
            { text: '路由逻辑', link: '/structure/route' },
            { text: '导航参数', link: '/structure/nav-params' },
          ],
        },
      ],
      '/develop/': [
        {
          items: [{ text: '导览', link: '/develop/' }],
        },
        {
          items: [
            { text: '代码结构', link: '/develop/code-structure' },
            { text: '环境准备', link: '/develop/environment-preparation' },
          ],
        },
        {
          text: '应用架构',
          collapsible: true,
          items: [
            {
              text: '基本元素',
              link: '/develop/application-framework/application-framework.md',
            },
          ],
        },
        {
          text: '规范',
          collapsible: true,
          items: [
            {
              text: '代码编写规范',
              link: '/develop/specification/code-specification.md',
            },
            {
              text: '样式编写规范',
              link: '/develop/specification/style-specification.md',
            },
            {
              text: '组件编写规范',
              link: '/develop/specification/component-specification.md',
            },
            {
              text: 'git提交规范',
              link: '/develop/specification/git-specification.md',
            },
            {
              text: '命名规范',
              link: '/develop/specification/name-specification',
            },
          ],
        },
      ],
      '/style-layout/': [
        {
          items: [
            { text: '样式', link: '/style-layout/style' },
            { text: '布局', link: '/style-layout/layout' },
            { text: '界面主题', link: '/style-layout/ui-theme' },
          ],
        },
      ],
    },
    docFooter: {
      prev: '上一页',
      next: '下一页',
    },
  },
  markdown: {
    anchor: {
      permalink: renderPermaLink,
    },
    config: md => {
      md.use(MarkDownItCustomAnchor);
    },
  },
};

export default config;
